package com.stox.ui.javafx.core.skin;

import javafx.scene.control.ChoiceBox;
import javafx.util.StringConverter;

import org.springframework.beans.factory.config.ConfigurableBeanFactory;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;

import com.stox.dto.Skin;

@Component
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
public class SkinChoiceBox extends ChoiceBox<Skin> {

	public SkinChoiceBox() {
		Skin skin = new Skin();
		skin.setName("Default Skin");
		getItems().add(skin);
		getSelectionModel().select(0);
		
		setConverter(new StringConverter<Skin>(){

			@Override
			public Skin fromString(String arg0) {
				// TODO Auto-generated method stub
				return null;
			}

			@Override
			public String toString(Skin skin) {
				return skin.getName();
			}
			
		});
	}
	
}
